<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>编辑文章 - 心理健康科普平台</title>
    <link rel="stylesheet" href="../css/navbar.css">
    <link rel="stylesheet" href="../css/search.css">
    <link rel="stylesheet" href="../css/common.css">
    <link rel="stylesheet" href="../css/editArticle.css">
    <script src="../js/user.js"></script>
    <script src="../js/auth.js"></script>
    <script src="../js/navbar.js"></script>
    <script src="../js/type.js"></script>
    <script src="../js/editArticle.js"></script>
</head>
<body>
    <div id="navbar-container"></div>

    <div class="container">
        <div class="edit-form">
            <form id="articleForm">
                <input type="hidden" id="articleId">
                <div class="form-group">
                    <label for="title">文章标题</label>
                    <input type="text" id="title" name="title" required placeholder="请输入文章标题">
                </div>

                <div class="form-group">
                    <label for="typeSelect">文章类型</label>
                    <select id="typeSelect" name="type_id" required onchange="typeChange()">
                        <!-- 类型选项动态加载 -->
                    </select>
                </div>

                <div class="form-group">
                    <label for="brief">文章简介</label>
                    <textarea id="brief" name="brief" placeholder="请输入文章简介（100字以内）" maxlength="100"></textarea>
                </div>

                <div class="form-group">
                    <label for="content">文章内容</label>
                    <textarea id="content" name="content" required placeholder="请输入文章内容"></textarea>
                </div>

                <div class="form-group">
                    <label for="source">文章来源</label>
                    <input type="text" id="source" name="source" placeholder="请输入文章来源">
                </div>

                <div class="form-group">
                    <label for="coverImage">封面图片</label>
                    <div class="image-preview empty" id="imagePreview">
                        <img id="previewImg" style="display: none;">
                    </div>
                    <input type="file" id="coverImage" name="img" accept="image/*" style="display: none;">
                </div>

                <div class="btn-group">
                    <button type="button" class="btn btn-secondary" onclick="goBack()">返回</button>
                    <button type="button" class="btn btn-primary" onclick="saveArticle()">保存文章</button>
                </div>
            </form>
        </div>
    </div>

  

</body>
</html>